<?php

namespace App\Services\User;

use App\Services\ProjectValidate;

/**
 * 当前模块验证规则集合 Token
 *
 * Class ValidateToken
 */
class ValidateToken extends ProjectValidate {
    /**
     * 类初始化
     * @param array $initData
     * @return mixed
     */
    public function initValidate($initData = [])
    {
        if (!empty($initData['requiredToken'])) {
            $this->rules['token']  = 'required|size:32';
        }
    }


    /**
     * @var array 验证规则集合
     */
    public $rules = [
        'id'                => 'int|min:1',
        'create_ip'         => 'ip',
        'create_app_key'    => 'size:32',
        'token'             => 'size:32'
    ];

    /**
     * @var array 当前验证错误信息
     */
    public $messages = [
    ];

    /**
     * @var array 上面规则中定义的 key 的名字
     */
    public $attributes = [
        'id'        => 'ID',
        'create_ip' =>  '用户IP'
    ];

}